Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pending transactions #1954

Merged
merged 12 commits into from
Jul 10, 2024
Merged

Pending transactions #1954

merged 12 commits into from
Jul 10, 2024

Conversation

lubej
Copy link
Collaborator

@lubej lubej commented May 27, 2024

Description

This PR addresses #1942. So the initial proposition was that we should decrease the time to fetch transactions. Which in my opinion does not solve the core issue, of not showing pending transaction. So this PR introduces a list of pending transactions, which should mitigate original issue in some way.

I wanted to introduce polling for each of the transactions, that would refresh the state of each pending transaction on each new block. But that introduces a state, where balance could be out of sync with the actual transaction history - also it would need a synchronous clock - which is also a hustle to implement, as the right approach IMO would be to refresh the balance/pending txs on each new block. oasis.client.NodeInternal function consensusWatchBlocks, would be ideal for that case, but does not seems to work, either there is an issue with TS client implementation or the grpc node does not support the method.

Resources

image

@lubej lubej requested a review from lukaw3d May 27, 2024 06:39
Copy link

github-actions bot commented May 27, 2024

Deployed to Cloudflare Pages

Latest commit: 09083aac670ab8c3737b70ae178b0caeef3c27e5
Status:✅ Deploy successful!
Preview URL: https://7ce6288b.oasis-wallet.pages.dev

@lubej lubej requested a review from buberdds May 27, 2024 06:40
@lubej lubej force-pushed the ml/pending-transactions branch 3 times, most recently from b4cfe60 to a3a0cb4 Compare May 27, 2024 06:48
src/app/state/transaction/saga.ts Outdated Show resolved Hide resolved
src/app/state/transaction/types.ts Outdated Show resolved Hide resolved
src/app/state/transaction/types.ts Outdated Show resolved Hide resolved
src/app/state/transaction/saga.ts Outdated Show resolved Hide resolved
src/app/state/transaction/index.ts Outdated Show resolved Hide resolved
src/app/components/Transaction/index.tsx Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 88.49558% with 13 lines in your changes missing coverage. Please review.

Project coverage is 79.80%. Comparing base (b7ecb22) to head (0e77efa).
Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1954      +/-   ##
==========================================
- Coverage   79.82%   79.80%   -0.03%     
==========================================
  Files         212      212              
  Lines        5467     5555      +88     
  Branches     1025     1059      +34     
==========================================
+ Hits         4364     4433      +69     
- Misses       1103     1122      +19     
Flag Coverage Δ
cypress 45.65% <67.32%> (+1.95%) ⬆️
jest 75.61% <67.25%> (-0.36%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/app/components/Transaction/index.tsx 85.82% <100.00%> (+3.09%) ⬆️
src/app/lib/getAccountBalanceWithFallback.ts 90.47% <100.00%> (-9.53%) ⬇️
.../AccountPage/Features/TransactionHistory/index.tsx 97.61% <100.00%> (+11.25%) ⬆️
src/app/pages/AccountPage/index.tsx 93.33% <100.00%> (+0.22%) ⬆️
src/app/state/persist/syncTabs.ts 79.31% <ø> (ø)
src/app/state/wallet/saga.ts 95.00% <100.00%> (ø)
src/config.ts 100.00% <ø> (ø)
src/utils/__fixtures__/test-inputs.ts 100.00% <ø> (ø)
src/utils/walletExtensionV0.ts 79.01% <ø> (ø)
src/app/state/account/index.ts 80.00% <90.90%> (+2.72%) ⬆️
... and 3 more

... and 1 file with indirect coverage changes

@@ -50,7 +53,16 @@ export function getOasisscanAPIs(url: string | 'https://api.oasisscan.com/mainne
return data
}

async function getTransactionsList(params: { accountId: string; limit: number }): Promise<Transaction[]> {
async function getTransaction({ hash }: { hash: string }) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Add cache mechanism, as transaction won't ever change once we already fetch it.

Copy link
Collaborator Author

@lubej lubej Jun 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lubej lubej force-pushed the ml/pending-transactions branch 5 times, most recently from 52f8586 to 62c1711 Compare June 10, 2024 05:32
@lubej lubej force-pushed the ml/pending-transactions branch 2 times, most recently from 2a37deb to 0e77efa Compare July 9, 2024 12:20
@lubej lubej force-pushed the ml/pending-transactions branch 2 times, most recently from 7273e31 to 21b1d9b Compare July 10, 2024 04:37
@lubej lubej merged commit 7ca812c into master Jul 10, 2024
13 checks passed
@lubej lubej deleted the ml/pending-transactions branch July 10, 2024 04:52
yield* put(accountActions.transactionsLoaded(transactions))

const detailedTransactions = yield* call(() =>
Promise.allSettled(transactions.map(({ hash }) => getTransaction({ hash }))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tries to incorrectly fetch paratime transactions too. See requests in:
https://wallet.dev.oasis.io/account/oasis1qry5d5zxs58w9deu5ara5zaamhkzqtg99s00ls90

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Is there any better way to determine if the tx is a runtime tx -> #1999?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants